<extend name="Index/index" />

<block name="mycss">
    
</block>

<block name="main">
    <div class="container">
        <div class="row">
            <div class="col-md-10 col-md-offset-1">
                <!-- 左侧 -->
                <div class="col-md-9">
                    <!-- 左上 1 -->
                    <div class="row mt10">
                        <div class="col-md-12">
                            <span class="glyphicon glyphicon-th-list"></span>
                            &ensp;<b>话题动态</b>
                        </div>
                        <div class="clearfix"></div>
                        <div class="mt10"></div>
                        <div class="divline"></div>
                    </div>
                    
                    <!-- 左上2 -->
                    <div class="row">
                        <div >
                            <div class="mt20">
                                <div class="w100">
                                    <img src="__PUBLIC__/imgs/<{$topicInfo.0.image}>" style="height:45px;width:45px;">
                                    <b><{$topicInfo[0]['name']}></b>
                                </div>
                            </div>
                            <div class="clearfix"></div>
                            <div class="divline mt20 mb20"></div>
                        </div>

                    </div>

                    <!-- 左侧正文 -->
                    <div class="row">
                        <div >
                            <!-- 判断数据是否为空 -->
                            <empty name="list">
                                <div class="w100 h5 mt10 text-center" style="background-color:#eee; height: 80px; line-height: 80px;">暂无更多问题推荐</div>
                            <else/>
                                <div class="w100 h5 text-center" style="background-color:#eee; height: 50px; line-height: 50px;">以下为您显示最新问题
                                </div>
                                <div class="mt10"></div>
                                <!-- 遍历搜索到的问题 -->
                                <div class="w100 mt10">
                                    <volist name="list" id="vo">
                                        <div class="w100">
                                            <div class="mt20">
                                                <a href="<{:U('Question/detail','qid='.$vo['qid'])}>" target="_blank"><b><{$vo.qname}></b></a>
                                                &nbsp;&nbsp;&nbsp;&nbsp;
                                                <a class="h6" style="color:#000" href="<{:U('People/index','uid='.$vo['quid'])}>" target="_blank"><{$vo.quname}></a>
                                                &nbsp;&nbsp;&nbsp;&nbsp;
                                                <{$vo.qanum}>个回答&nbsp;&nbsp;
                                            </div>
                                            <div class="mt10"><a href="" class="attend h6" question_id="<{$vo.qid}>"><span class="glyphicon glyphicon-plus"></span>关注问题</a>&ensp;</div>
                                            <div class="mt10"></div>

                                            <notempty name="vo.aid">
                                            <!-- 不空显示回答的信息 -->
                                                <div class="w100"  style="font-size:12px;">
                                                    <p>
                                                        <a href="<{:U('Question/detail',array('qid'=>$vo['qid'],'aid'=>$vo['aid']))}>" target="_blank" style=" color:#000">&ensp;&ensp;&ensp;&ensp;<{$vo.apart}>...</a>
                                                    </p>
                                                    <p class="h6 mt10">
                                                        回答时间: <{$vo.atime}> &nbsp;&nbsp; &nbsp;&nbsp;
                                                        <{$vo.azan}>赞同 &nbsp;&nbsp; &nbsp;&nbsp;
                                                        <{$vo.adnum}>评论 &nbsp;&nbsp; &nbsp;&nbsp;
                                                    </p>
                                                </div>
                                            </notempty>
                                            <!-- <div class="mt10"></div> -->
                                            <div class="divline mt20"></div>
                                            

                                        </div>
                                    </volist>
                                </div>

                                <div class="mt20"></div>
                                <div class="w100">
                                    <a href="<{:U('Explore/index', array('name'=>$name, 'type'=>'question','p'=>$p))}>" class="btn btn-sm btn-default form-control">查看更多问题</a>
                                </div>
                                <div class="mb50"></div>
                            </empty>
                        </div>

                    </div>
                </div><!--左侧结束-->

                <!-- 右侧开始 -->
                <div class="col-md-3">
                <div style="height:100px;">
                    <a href="" class="attend_t h6 text-right btn btn-success" topic_id="<{$topicInfo[0]['id']}>">关注话题</a>
                    <div class="mt20">组织&nbsp;·&nbsp;管理&nbsp;·&nbsp;日志</div>
                    <hr>
                </div>
                <div>
                 <div class="mt10"><b>描述</b></div>
                    <div class="mt10"><h5 style="color:#222;"><{$topicInfo[0]['detail']}></h5></div>
                </div>
                <!-- <div style="height:200px;background-color:#abcdef;" class="mt10">放图占位</div> -->

                </div>
            </div>
        </div>
    </div>
</block>

<block name="myjs">
<script>

/*$('.hehe').click(function(){
    if ($(this).text() == '关注话题') {
        $(this).text('取消关注');
        $(this).attr('class','btn btn-default');
    }else{
        $(this).text('关注话题');
        $(this).attr('class','btn btn-success');
    };
})*/

</script>

    <script type="text/javascript">
        //话题关注
        var tattend = $('a.attend_t');
            for (var i = 0; i < tattend.length; i++) {
                $(tattend[i]).click(function(){
                    // console.log($(this));
                    var tid = $(this).attr('topic_id');
                    // console.log(uid);
                    // 判断a标签是关注还是否
                    if ($(this).text() == '关注话题') {
                        $.ajax({
                            type: 'get',
                            url: "<{:U('Attend/attendT')}>",
                            data: 'id=' + tid,
                        });
                        $(this).text('取消关注');
                    } else {
                        $.ajax({
                            type: 'get',
                            url: "<{:U('Attend/notAttendT')}>",
                            data: 'id=' + tid,
                        });
                        $(this).html('关注话题');
                    };
                    return false; //阻止跳转
                });
            }; // 关注话题点击事件结束
    </script>


</block>































